<style type="text/css" media="all">@import "loginregister.css";</style>
<?php
    session_start();
	include("../../dbconnect.inc.php");
	if($_GET["name"] != "") {
		$name = addslashes($_GET["name"]);
		$where .= " and username like '%{$name}%' ";
	}
	$sql = "select * from users where 1 {$where} limit 20";
	$res = mysql_query($sql);
?>
 <table id="content" border="0" cellpadding="0" cellspacing="6" class="border" >
  <tr>
  <td>
  <h2>userlist</h2><div class="help"><p>welcome to userlist . The following is the latest user's name</p>
</div><hr />
<!-- begin content -->
<script language="javascript">
	function doDel(title,id) {
		if(confirm('Are you sure cancel the user\n-------------------------\n'+title+'\n-------------------------'))
			location.href='del_account.php?id='+id;
	}
</script>
<table width="100%">
 <thead><tr><th> </th><th>user name</th><th >sex</th><th>email</th><th>registe time</th><th>operate</th> </tr></thead>
<tbody>
<?php
	while($row = mysql_fetch_array($res)) {
		switch($row["sex"]) {
			case	"1"	:
				$sex = "male";
				break;
			case	"2"	:
				$sex = "famale";
				break;
			default		:
				$sex = "secret";
				break;
		}
		echo "<tr ><td></td>";
		echo "<td>{$row['username']}</td>";
		echo "<td >{$sex}</td>";
		echo "<td>{$row['mail']}</td>";
		echo "<td class='active'>{$row['reg_time']}</td>";		
		echo "<td><a href='detail.php?id={$row['id']}'>lookup</a></td> </tr>";
		
	}
?>
</tbody></table>
<?php 
	if(mysql_num_rows($res)==0) echo "none";
?>
<!-- end content -->
   </td>
  </tr>
 </table>
<?php echo $page_link; ?>
